package com.wyf.test.view

import android.content.Context
import android.support.v4.app.FragmentActivity
import android.os.Bundle
import android.widget.Toast

import com.wyf.test.R
import com.example.utils.JNIUtils
import com.wyf.test.util.Tools

/**
 * view的手势控制
 */
class TestListViewActivity : FragmentActivity() {

    private var textView: ScrollView? = null
    private var context: Context? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_test_list_view)
        println("=========" + JNIUtils.hiJNI())
        println("=========" + JNIUtils.Multiplication(3, 9))

        context = this@TestListViewActivity
        textView = findViewById(R.id.ScrollViewtest) as ScrollView
        textView!!.setOnGestureListener(object : ScrollView.GestureListener {
            override fun onConfirm() {
                Tools.vibrateTime(context, 500)
                Toast.makeText(context, "确认", Toast.LENGTH_SHORT).show()
            }

            override fun onLeftScrolled() {
                Tools.vibrateTime(context, 500)
                Toast.makeText(context, "左", Toast.LENGTH_SHORT).show()
            }

            override fun onRightScrolled() {
                Tools.vibrateTime(context, 500)
                Toast.makeText(context, "右", Toast.LENGTH_SHORT).show()
            }

            override fun onDownScrolled() {
                Tools.vibrateTime(context, 500)
                Toast.makeText(context, "下", Toast.LENGTH_SHORT).show()
            }

            override fun onUpScrolled() {
                Tools.vibrateTime(context, 500)
                Toast.makeText(context, "上", Toast.LENGTH_SHORT).show()
            }
        })
    }

    companion object {

        private val TAG = "TestListViewActivity"
    }

}
